package com.mervin.patterns.decorator;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-21 22:18
 * @Description:
 ***************************************/
public class Decorator extends Drink {

    private Drink obj;

    public Decorator(Drink obj) { //组合
        this.obj = obj;
    }

    @Override
    public float cost() {
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        return des + ":" + getPrice() + " && " + obj.getDes();
    }
}
